//1.引入http组件
let http = require('http');
//创建服务器
http.createServer((req, res) => {

    if (req.url == '/favicon.ico') {
        return;
    }

    res.setHeader('Content-Type', 'text/html;charset=utf-8');
    if (req.url == '/' || req.rul == '/index') {
        res.end('<h1>首页</h1>');
    } else if (req.rul == '/login') {
        res.end('登入页面');
    } else if (req.rul == '/reg') {
        res.end('注册页面');
    } else if (req.url == '/productlist') {
        res.end('产品列表');
    } else if (req.url == '/productlist') {
        res.end('产品列表');
    } else {
        res.end('404');
    }

}).listen(800, 'www.2339737236.com', () => {
    console.log('服务器启动成功');
})